<template>
	<view>
		<image src="/static/o5.png" mode=""></image>
		<view class="t1">
			已下单
		</view>
		<view class="t2">
			感谢您的购买
		</view>
		<view class="t3">
			<text>￥</text>{{price}}
		</view>

		<view class="t4" @click="goorder">
			查看订单
		</view>
		<view class="t5" @click="goindex">
			返回首页
		</view>
	</view>
</template>

<script setup>
	import {
		useStore
	} from 'vuex';
	import {
		getShopCar
	} from '@/common/http.api.js';
	import {
		onLoad
	} from '@dcloudio/uni-app'
	import {
		ref
	} from 'vue';
	const store = useStore();
	const price = ref(0)
	onLoad((option) => {
		price.value = option.price
		console.log(option);
		getShopCar({}).then(res => {
			if (res.code == 200) {
				let total = res.data.reduce((sum, e) => sum + Number(e.productCount || 0), 0)
				store.commit('setShopNum', total)
			}
		})
	})

	function goorder() {
		uni.redirectTo({
			url: '/pages/user/order'
		})
	}

	function goindex() {
		uni.switchTab({
			url: '/pages/index/index'
		})
	}
</script>

<style lang="scss">
	page {
		background: #F8F8F8;
		text-align: center;
	}

	image {
		width: 80rpx;
		height: 80rpx;
		margin-top: 100rpx;
	}

	.t1 {
		font-family: PingFang SC, PingFang SC;
		font-weight: bold;
		font-size: 40rpx;
		color: #000000;
		margin-top: 22rpx;
	}

	.t2 {
		font-family: PingFang SC, PingFang SC;
		font-weight: 500;
		font-size: 24rpx;
		color: #8E8E8E;
		margin-top: 14rpx;
	}

	.t3 {
		margin-top: 32rpx;
		font-family: PingFang SC, PingFang SC;
		font-weight: 800;
		font-size: 70rpx;
		color: #000000;

		text {
			font-size: 40rpx;
		}
	}

	.t4 {
		width: 320rpx;
		height: 80rpx;
		background: #FF7700;
		border-radius: 40rpx 40rpx 40rpx 40rpx;
		font-family: PingFang SC, PingFang SC;
		font-weight: 500;
		font-size: 30rpx;
		color: #FFFFFF;
		line-height: 80rpx;
		text-align: center;
		margin: 120rpx auto 70rpx;
	}

	.t5 {
		font-family: PingFang SC, PingFang SC;
		font-weight: 500;
		font-size: 30rpx;
		color: #979797;
	}
</style>